//
//  sssss.swift
//  C006_test_custom_table
//
//  Created by yao_yu on 15/5/27.
//  Copyright (c) 2015年 yao_yu. All rights reserved.
//

import Foundation

extension Array {
    
    /**
    Iterates on each element of the array.
    
    :param: call Function to call for each element
    */
    func each (call: (Element) -> ()) {
        
        for item in self {
            call(item)
        }
        
    }
    
    /**
    Iterates on each element of the array with its index.
    
    :param: call Function to call for each element
    */
    func each (call: (Int, Element) -> ()) {
        
        for (index, item) in enumerate() {
            call(index, item)
        }
        
    }
}